// export const 
const corpId = 'wwcfd8d8c8e7a3e382' // 企业id
const appId = '1000022'// 应用id

const redirect_uri = 'http://zftsglwe.yilvzp.com'  // 前端路由地址 
const fixedCode = 'Go8y8bQTeHX_xYTa6eTUmLYaXTqVE9gi1D1_dVbHvi4' // 固定的code  

/** 重定向地址（微信sdk授权使用） */
const getRedirectUrl = () => {
  return location.href.split('#')[0]
}



// https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwcfd8d8c8e7a3e382&redirect_uri=http%3A%2F%2Fzftsglwe.yilvzp.com&response_type=code&scope=snsapi_base&state=&agentid=1000022#wechat_redirect
/** 首页地址 */
const redirectPage = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${encodeURIComponent(redirect_uri)}&response_type=code&scope=snsapi_base&state=#wechat_redirect`

// /** 分享地址 */
// const shareRouteUrl = (userId: any, areaId: any) => {
//   // /perfectInfo?userId=502544451469381&areaId=1
//   return `${redirect_uri}/#/perfectInfo?userId=${userId}&areaId=${areaId}`
// }

/** 判断没有登录情况下，回调地址 */
const getFlagUrl = () => {
  // const hash = window.location.hash;
  // const hashWithoutHashSymbol = hash.substring(2);
  // const [path, queryString] = hashWithoutHashSymbol.split('?');
  // const params = new URLSearchParams(queryString);

  return redirectPage
}


/** 配置 */
export const config = {
  corpId,
  appId,
  redirect_uri,
  redirectPage,
  fixedCode,
  /** 获取地址，wx鉴权 */
  getRedirectUrl,
  getFlagUrl,
  /** 分享地址 */
  // shareRouteUrl
}